//
//  DetectionSystemVersion.m
//  models
//
//  Created by juvid on 13-9-23.
//  Copyright (c) 2013年 minfo. All rights reserved.
//

#import "DetectionSystemVersion.h"

@implementation DetectionSystemVersion
-(BOOL)Version{
    NSString *strVersion=[[UIDevice currentDevice] systemVersion];
    float fltVersion=[strVersion floatValue];
    if (fltVersion>=7.0) {
        return YES;
    }
    return NO;
}
+(UILabel *)SetBarTitle:(NSString *)labTille{
    UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 150, 30)];
    customLab.backgroundColor=[UIColor clearColor];
    [customLab setTextColor:[UIColor whiteColor]];
    customLab.textAlignment=NSTextAlignmentCenter;
    [customLab setText:labTille];
    customLab.font = [UIFont boldSystemFontOfSize:18];
    return customLab;
}

-(UIView *)SetVieTitle:(NSString *)labTille Fram:(CGRect)fram ImageName:(NSString *)imgName{
    UIView *vieBar=[[UIView alloc]initWithFrame:fram];
    UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(38, 0, 150, fram.size.height)];
    customLab.backgroundColor=[UIColor clearColor];
    [customLab setTextColor:[UIColor whiteColor]];
    customLab.textAlignment=NSTextAlignmentLeft;
    [customLab setText:labTille];
    customLab.font = [UIFont boldSystemFontOfSize:15];
    [vieBar addSubview:customLab];
    UIImageView *imgBar=[[UIImageView alloc]initWithFrame:CGRectMake(10, 6, 16, 16)];
    imgBar.image=[UIImage imageNamed:imgName];
    [imgBar setClipsToBounds:YES];
    [imgBar setContentMode:UIViewContentModeScaleAspectFit];
    [vieBar addSubview:imgBar];
    return vieBar;
}

-(UIControl *)SetBarTitle{
    UIControl *btnBack=[[UIControl alloc]initWithFrame:CGRectMake(0, 0, 50, 30)];
//    [btnBack addTarget:self action:@selector(BackReturn:) forControlEvents:UIControlEventTouchUpInside];
    UIImageView* Backbg=[[UIImageView alloc]initWithFrame:CGRectMake(7, 8, 20, 15)];
    Backbg.image=[UIImage imageNamed:@"return"];
    [btnBack addSubview:Backbg];
   
    return btnBack;
}
-(UIButton *)BackButton{
    UIButton *btnMessage=[[UIButton alloc]init];
    btnMessage.contentEdgeInsets = UIEdgeInsetsMake(0,8, 0, 0);
    [btnMessage setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [btnMessage setTitle:@"返回" forState:UIControlStateNormal];
    btnMessage.titleLabel.font=[UIFont systemFontOfSize:16];
    [btnMessage setBackgroundImage:[UIImage imageNamed:@"return"] forState:UIControlStateNormal];
       if ([[DetectionSystemVersion alloc]Version]) {
        btnMessage.frame=CGRectMake(0, 0, 48, 29);
       
    }
    else{
        btnMessage.frame=CGRectMake(5, 0, 48, 29);
        
    }
    //    btn.imageEdgeInsets = UIEdgeInsetsMake(0, -20, 0, 0);
    return btnMessage;
    
}
+(CGSize)String:(NSString *)string Width:(float)width Font:(int)font{
    CGSize sizeFrame;
        if (string.length!=0) {
            sizeFrame =[string sizeWithFont:[UIFont systemFontOfSize:font] constrainedToSize:CGSizeMake(width, MAXFLOAT) lineBreakMode:NSLineBreakByWordWrapping];
            //            NSLog(@"%@",arrRowHight);
        }
    return sizeFrame;

}
@end
